48. Package management

Note

The below information is extensively based in information taken from the PowerShell® Notes for Professionals book. I plan to extend this information based on my day to day usage of the language.

PowerShell Package Management allows you to find, install, update and uninstall PowerShell Modules and other packages.

PowerShellGallery.com is the default source for PowerShell modules. You can also browse the site for available packages, command and preview the code.

48.1: Create the default PowerShell Module Repository

If for some reason, the default PowerShell module repository PSGallery gets removed. You will need to create it.

This is the command.

1
Register-PSRepository -Default

48.2: Find a module by name

1
Find-Module -Name <Name>

48.3: Install a Module by name

1
Install-Module -Name <name>

48.4: Uninstall a module my name and version

1
Uninstall-Module -Name <Name> - RequiredVersion <Version>

48.5: Update a module by name

1
Update-Module -Name <Name>

48.6: Find a PowerShell module using a pattern

To find a module that ends with DSC

1
Find-Module -Name *DSC